Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split let control flow into mutliple sub-slides #2567

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

djmitche
Copy link
Collaborator

There are three kinds of syntax here, making for a very long and hard-to-navigate slide. Splitting it up helps!

There are three kinds of syntax here, making for a very long and
hard-to-navigate slide. Splitting it up helps!
@djmitche djmitche requested a review from hurryabit January 19, 2025 07:25
Copy link
Collaborator

@hurryabit hurryabit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good idea.

if let Some(digit) = first_byte_char.to_digit(16) {
Ok(digit)
} else {
return Err(String::from("not a hex digit"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at this: Is the return here very idiomatic? It's basically in tail position, so just having Err(...) would seem better to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree this was not idiomatic, the code on this section is intended to be rewritten to use let-else. Therefore it might actually be desirable to keep the returns so that presenters can just copy-paste the returns into the let-else rather than having to add them manually.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's why they existed. @hurryabit what are your thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, there's more value if the attendees get to compare two idiomatic versions. In fact, having to write a little more slows down things a bit and gives people more time to digest what we're teaching them. I would think that the slowdown introduced by having to write return three times is very reasonable.

All that said, I'd prefer to start with the idiomatic version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's what the current version of the PR is -- do you want to mark it approved?

Copy link
Collaborator

@hurryabit hurryabit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I already had approved. Here we go.

@djmitche djmitche merged commit 3b7442a into google:main Jan 22, 2025
35 checks passed
@djmitche
Copy link
Collaborator Author

danke!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants